﻿using MyAMS.WebServer.Models;

namespace MyAMS.WebServer.ViewModels
{
    /// <summary>
    /// 用户视图模型
    /// </summary>
    public class UserViewModel
    {
        /// <summary>
        /// 初始化一个新的 <see cref="UserViewModel"/> 类的实例
        /// </summary>
        /// <param name="user">The user.</param>
        public UserViewModel(BaseUser user)
        {
            Name = user.Name;
            DisplayName = user.DisplayName;
            Email = user.Email;
            CanAccessAdmin = user is User; //TODO: 这里不能这么判断
            IsAuthenticated = user is User;
        }

        /// <summary>
        /// 获取或设置名称
        /// </summary>
        public string Name { get; private set; }

        /// <summary>
        /// 获取或设置显示名称
        /// </summary>
        public string DisplayName { get; private set; }

        /// <summary>
        /// 获取或设置电子邮件
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 获取或设置一个值, 改制指示当前实例是否经过认证
        /// </summary>
        public bool IsAuthenticated { get; set; }

        /// <summary>
        /// 获取或设置一个值, 改制指示当前实例是可以访问管理员
        /// </summary>
        public bool CanAccessAdmin { get; set; }
    }
}
